﻿<?xml version="1.0" encoding="utf-8" ?>

<xs:schema id="MenuSheme"
           targetNamespace="FarmersBreakfast.Menu"
           elementFormDefault="qualified"
           xmlns="FarmersBreakfast.Menu"
           xmlns:mstns="http://tempuri.org/MenuSheme.xsd"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:include schemaLocation="Enumerations.xsd" />

  <xs:simpleType name="Color">
    <xs:restriction base="xs:string">
      <xs:pattern value="#[0-9, A-F]{6}" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="Opacity">
    <xs:restriction base="xs:int">
      <xs:minInclusive value="0" />
      <xs:maxInclusive value="100" />
    </xs:restriction>
  </xs:simpleType>

  <xs:attributeGroup name="Dimension">
    <xs:attributeGroup ref="Position" />
    <xs:attributeGroup ref="Size" />
  </xs:attributeGroup>

  <xs:attributeGroup name="Position">
    <xs:attribute name="X" type="xs:int" use="required" />
    <xs:attribute name="Y" type="xs:int" use="required" />
  </xs:attributeGroup>

  <xs:attributeGroup name="Size">
    <xs:attribute name="Width" type="xs:int" default="0" />
    <xs:attribute name="Height" type="xs:int" default="0" />
  </xs:attributeGroup>

  <xs:complexType name="GameComponent">
    <xs:sequence>
      <xs:element name="ToolTip" type="ToolTip" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="Id" type="xs:string" use="required" />
    <xs:attribute name="Layer" type="xs:float" />
    <xs:attribute name="Opacity" type="Opacity" use="required" />
    <xs:attribute name="Command" type="xs:string" />
  </xs:complexType>

  <xs:complexType name="Container">
    <xs:complexContent>
      <xs:extension base="GameComponent">
        <xs:sequence maxOccurs="unbounded">
          <xs:element name="Text" type="Text" minOccurs="0" maxOccurs="unbounded" />
          <xs:element name="TextInput" type="TextInput" minOccurs="0" maxOccurs="unbounded" />
          <xs:element name="Texture" type="Texture" minOccurs="0" maxOccurs="unbounded" />
          <xs:element name="SpriteTexture" type="SpriteTexture" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:attribute name="SizeModifier" type="SizeModifier" />
        <xs:attribute name="BackgroundColor" type="Color" />
        <xs:attributeGroup ref="Dimension" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="Text">
    <xs:complexContent>
      <xs:extension base="GameComponent">
        <xs:attribute name="Value" type="xs:string" use="required" />
        <xs:attribute name="Size" type="Size" use="required" />
        <xs:attribute name="Font" type="Font" use="required" />
        <xs:attribute name="LineHeight" type="xs:int" />
        <xs:attribute name="HorizontalAlignment" type="HorizontalAlignment" />
        <xs:attribute name="VerticalAlignment" type="VerticalAlignment" />
        <xs:attribute name="Stack" type="xs:boolean" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="TextInput">
    <xs:complexContent>
      <xs:extension base="Text">
        <xs:attribute name="Length" type="xs:int" />
        <xs:attribute name="InputX" type="xs:int" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="Texture">
    <xs:complexContent>
      <xs:extension base="GameComponent">
        <xs:attribute name="Source" type="xs:string" />
        <xs:attribute name="HorizontalAlignment" type="HorizontalAlignment" />
        <xs:attribute name="VerticalAlignment" type="VerticalAlignment" />
        <xs:attribute name="BackgroundColor" type="Color" />
        <xs:attributeGroup ref="Dimension" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="SpriteTexture">
    <xs:complexContent>
      <xs:extension base="GameComponent">
        <xs:attribute name="Source" type="xs:string" />
        <xs:attribute name="HorizontalAlignment" type="HorizontalAlignment" />
        <xs:attribute name="VerticalAlignment" type="VerticalAlignment" />
        <xs:attribute name="BackgroundColor" type="Color" />
        <xs:attribute name="SpriteCount" type="xs:int" />
        <xs:attribute name="Time" type="xs:int" />
        <xs:attributeGroup ref="Dimension" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="ToolTip">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="Id" type="xs:string" use="required" />
        <xs:attribute name="Layer" type="xs:double" />
        <xs:attribute name="Opacity" type="Opacity" use="required" />
        <xs:attribute name="Size" type="Size" use="required" />
        <xs:attribute name="Font" type="Font" use="required" />
        <xs:attribute name="LineHeight" type="xs:int" />
        <xs:attribute name="HorizontalAlignment" type="HorizontalAlignment" />
        <xs:attribute name="VerticalAlignment" type="VerticalAlignment" />
        <xs:attribute name="BackgroundColor" type="Color" />
        <xs:attribute name="Padding" type="xs:int" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:schema>